﻿using System.Collections.Generic;
using PerceptiveMCAPI;

namespace PerceptiveMCAPI_UI.Controls.get
{
   public partial class sub_RssOptions : System.Web.UI.UserControl
   {
      public Dictionary<string, string> type_opts
      {
         get { return getTypeOptions(); }
      }
      // ----------------------------
      public void Setup()
      {
         this.Visible = true;
         this.ddlschedule_Value.SelectedValue = MCAPISettings.default_campaign_rss_schedule.ToString();
         this.txtschedule_hour_Value.Text = MCAPISettings.default_campaign_rss_schedule_hour;
         this.ddlSchedule_Weekday.SelectedValue = MCAPISettings.default_campaign_rss_schedule_weekday.ToString();
         this.txtschedule_monthday_Value.Text = MCAPISettings.default_campaign_rss_schedule_monthday;
      }
      // ----------------------------------------------------
      private Dictionary<string, string> getTypeOptions()
      {
         Dictionary<string, string> opts = new Dictionary<string, string>();
         //
         string schedule = ddlschedule_Value.SelectedValue;
         //
         opts.Add( txturl.Text, txturl_Value.Text.Trim() );
         opts.Add( txtschedule.Text, schedule );
         opts.Add( txtschedule_hour.Text, txtschedule_hour_Value.Text.Trim() );
         if ( schedule == EnumValues.campaign_Rss_Schedule.weekly.ToString() )
            opts.Add( txtschedule_weekday.Text, ddlSchedule_Weekday.SelectedIndex.ToString() );
         else if ( schedule == EnumValues.campaign_Rss_Schedule.monthly.ToString() )
            opts.Add( txtschedule_monthday.Text, txtschedule_monthday_Value.Text );
         //
         return opts;
      }
   }
}